package com.example.mywechatprogram.controller;
import com.example.mywechatprogram.entity.Book;
import com.example.mywechatprogram.entity.Response;
import com.example.mywechatprogram.mapper.BookMapper;
import com.example.mywechatprogram.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class BookController {
    @Autowired
    private BookService bookService;

    @PostMapping("/Book/insertBook")
    public Response addbook(String userId,String bookId){
      return bookService.addbook(userId,bookId);
    }
    @PostMapping("/Book/delBook")
    public Response delbook(String userId,String bookId){
        return bookService.delbook(userId,bookId);
    }
    @GetMapping("/Book/get")
    public Response get() {
        return bookService.query();
    }
    @GetMapping("/Book/query")
    public Response query(String user_id){return bookService.queryByUser(user_id);}
}
